<template>
    <view class="container" :style="themeColor">
        <view class="record-top">
            <view class="record-top-top"
                >应付金额<text class="space"
                    >¥<text class="num-text">{{ PriceSum }}</text></text
                >
            </view>
            <view class="record-top-bot">
                <view>
                    <text>待确认金额</text>
                    <view>¥{{ WaitCheckPrice }}</view>
                </view>
                <view style="padding-left: 40rpx">
                    <text>未付金额</text>
                    <view>¥{{ ArrearsPrice }}</view>
                </view>
            </view>
        </view>
        <view class="title">付款记录</view>
        <view class="main">
            <payment-record-list
                v-if="loadOk"
                :ref="mescrollDiv"
                :height="height"
                :orderId="orderId"></payment-record-list>
        </view>
        <view class="footer" v-if="ArrearsPrice > 0">
            <button class="btn" @click="goUrl('/pages_shop/packet/order/waitPayList?orderId=' + orderId)">
                立即付款
            </button>
        </view>
    </view>
</template>

<script>
import { GetPayListByOrderId } from "@/service/api/order.js"
import { sortBykey } from "@/uni-sub-base/utils/utils.js"
import { getElementHeight } from "@/uni-sub-base/utils/elementUtil.js"
import paymentRecordList from "@/pages_supplier/components/order/payment-record-list.vue"
export default {
    components: {
        paymentRecordList,
    },
    data() {
        return {
            orderId: "",
            loadOk: false,
            height: "", //list所需高度
            param: {},
            datas: [],
            downOption: {
                use: true,
            },
            PriceSum: "",
            ArrearsPrice: "",
            WaitCheckPrice: "",
        }
    },
    onLoad(e) {
        this.orderId = e.orderId
        this.PriceSum = e.PriceSum
        this.ArrearsPrice = e.ArrearsPrice
        this.WaitCheckPrice = e.WaitCheckPrice
    },
    mounted() {
        this.getListHeight()
    },
    methods: {
        getListHeight(element) {
            //获取商品高度
            getElementHeight(this, ".main", (e) => {
                if (this.ArrearsPrice > 0) {
                    this.height = e - 60 + "px"
                } else {
                    this.height = e + "px"
                }
                this.loadOk = true
            })
        },

        goUrl(url) {
            this.easyGoTo(url)
        },
    },
}
</script>

<style lang="scss">
.container {
    padding: $app-page-padding $app-page-padding 0 $app-page-padding;
}

.record-top {
    height: 202rpx;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 54rpx 40rpx 48rpx 40rpx;
    background: $app-color-main url(/static/img/bg-top.png) no-repeat;
    background-size: 100% 100%;
    border-radius: 24rpx;
    color: #ffffff;

    text {
        color: #ffffff;
    }
}

.record-top-top {
    font-size: 28rpx;

    .space {
        padding-left: 26rpx;
    }
}

.num-text {
    font-size: 48rpx;
    font-weight: bold;
}

.record-top-bot {
    display: flex;

    text {
        font-size: 24rpx;
        font-weight: normal;
    }

    view {
        font-size: 40rpx;
        font-weight: bold;
        width: 50%;
    }
}

.title {
    font-size: 32rpx;
    padding: 32rpx 0;
}

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120rpx;
    display: flex;
    background: #ffffff;
    justify-content: center;
    align-items: center;
    padding-bottom: constant(safe-area-inset-bottom);
    /*兼容 IOS<11.2*/
    padding-bottom: env(safe-area-inset-bottom);

    /*兼容 IOS>11.2*/
    .btn {
        color: $color-white;
        background: $app-color-main;
        width: 690rpx;
        height: 90rpx;
        background: #008c3b;
        border-radius: 45rpx;
        font-size: 32rpx;
    }
}
</style>
